package top.leix.springdemo.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import top.leix.springdemo.Res;
import top.leix.springdemo.services.ApplyRepairTeacherService;
import top.leix.springdemo.services.CommonService;
import top.leix.springdemo.services.LabService;

import javax.annotation.Resource;

@Slf4j
@Tag(name = "实验员")
@CrossOrigin
@RestController
@RequestMapping("/labAssistant")
public class LabAssistantController {

    @Resource
    ApplyRepairTeacherService applyRepairTeacherService;

    /**
     * 根据管理员名字查看维修表
     */
    @PostMapping("/queryRepairByName")
    public Res queryLab(@RequestBody String userName) {
        return applyRepairTeacherService.queryRepairByName(userName);
    }

    /**
     * 更新维修状态,前端直接传状态
     * @param applyID
     * @param status
     * @return
     */
    @PostMapping("/updateRepairStatus")
    public Res updateRepairStatus(@RequestBody Integer applyID,String status) {
        return applyRepairTeacherService.updateRepairStatus(applyID,status);
    }
    /**
     *
     * @param applyID
     * @param note
     * @return
     */
    @PostMapping("/addRepairNote")
    public Res addRepairNote(@RequestBody Integer applyID,String note) {
        return applyRepairTeacherService.addRepairNote(applyID,note);
    }
}
